package com.sdau.soa.controller;



import com.sdau.soa.dao.NewsDao;
import com.sdau.soa.dao.NewsTypeDao;
import com.sdau.soa.service.INewsService;
import com.sdau.soa.service.impl.NewsServiceImpl;
import com.sdau.soa.vo.News;
import com.sdau.soa.vo.NewsType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;

@Controller
public class helloController {
    @Autowired
	NewsDao newsDao;
    @Autowired
    NewsServiceImpl newsService;
	@RequestMapping("/hi")
    @ResponseBody
	public String hellospringboot() throws ParseException {
        //获得2010年9月13日22点36分01秒 的Date对象
        DateFormat dateFormat2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date date = dateFormat2.parse("2010-09-13 22:36:01");
        Date date2 = dateFormat2.parse("2019-09-13 22:36:01");
        List<News> ln = newsService.searchByInfo("辽宁",date,date2);
        for(News n:ln)
        {
            System.out.println(n.getTitle());
        }
        return "mian";

    }


}